refactor: decompose large macros and improve code organization#101
Merged
mikehostetler merged 1 commit intoagentjido:mainfrom Jan 23, 2026
Merged
refactor: decompose large macros and improve code organization#101mikehostetler merged 1 commit intoagentjido:mainfrom
mikehostetler merged 1 commit intoagentjido:mainfrom
Conversation
- Refactored `Jido.Agent.__using__/1` macro by extracting quoted code into separate helper functions to avoid Credo "long quote blocks" and "nested too deep" warnings. Compile-time validation and runtime code are now clearly separated. - Applied similar decomposition to `Jido.Skill.__using__/1` macro, breaking it into focused helper functions for behaviour setup, accessors, and callbacks. - Extracted complex conditional logic into private helper functions across multiple modules (AgentServer, Cron directive, Await, Routes, etc.) to improve readability and reduce nesting depth. - Standardized alias usage throughout codebase: added module aliases at top of files and replaced inline module references with aliased versions. - Fixed idle timer handling in Keyed lifecycle to use `:erlang.start_timer/3` with timer refs instead of `Process.send_after/3`, preventing stale timeout messages from triggering after cancel/reset. - Added `restart: :transient` to InstanceManager child specs to avoid immediate restarts on normal shutdown/idle timeout while still allowing restarts on crashes. - Added logger configuration for Jido telemetry metadata keys. - Replaced `length(list) >= N` comparisons with pattern matching or `!= []` in tests for more idiomatic Elixir. - Used `Enum.map_join/3` instead of `Enum.map/2 |> Enum.join/2` where applicable. - Reordered aliases alphabetically in test files for consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing